using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Friso.Entities;
using Friso.Business;
using Friso.Data;
using FetCo.Framework;
using FetCo.Data;

public partial class Admin_MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
            return;
        string filename = string.Empty;
        filename = "~/Languages/VietNamese.xml";
        Utilitys.Dictionary = Utilitys.GetLanguageadmin(Server.MapPath(filename));
        LoadUser();
    }
    protected void LoadUser()
    {
        if (Session["userid"] != null)
        {
            Criteria criuser = new Criteria();
            criuser.add("[" + User._Table + "].[" + UserColumns.UserId + "]", long.Parse(Session["userid"].ToString()), Condition.EQUAL, Condition.AND);
            Friso.Entities.UserCollection _UserCollection = UserService.GetUserListByParam(UserColumns.UserId, OrderDirection.ASC, criuser.Criter);
            User _User = new User();
            if (_UserCollection.Count > 0)
            {
                _User = _UserCollection[0];
                aWellcom.InnerText = _User.FullName;
                aWellcom.HRef = "User.aspx?userId=" + _User.UserId.ToString();
                
            }
        }
        else
        {
            Response.Redirect("~/Login.aspx");
        }
    }
    protected bool IsCurrent(int menuitem)
    {
        if (GetCurrentMenu() == menuitem)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    protected int GetCurrentMenu()
    {
        if (Session["CurrentMenu"] == null)
            return 0;
        else
            return int.Parse(Session["CurrentMenu"].ToString());
    }
    protected bool SubCurrent(int menuitem)
    {
        if (GetSubCurrentMenu() == menuitem)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    protected int GetSubCurrentMenu()
    {
        if (Session["SubCurrentMenu"] == null)
            return 0;
        else
            return int.Parse(Session["SubCurrentMenu"].ToString());
    }
}
public enum Menus
{
    Admin,
    Member,
    Clip,
    Milk,
    Article


}
public enum SubMenus
{
    CreateUser,
    MemberList,
    CreateMember,
    ClipList,
    ImageList,
    TestList,
    CreateImages,
    CreateClip,
    CreateMilk,
    ListMilk,
    ListArticle,
    CreateArticle,
    ListCategory



}
